
<style type="text/css">
.storelogo img{width:3.2rem;height:3.2rem}
.merchgroup .store-star {padding:0.1rem 0 0.2rem 0;font-size:0.55rem;line-height:1rem}
.merchgroup .store-star img{height:0.66rem}
.star-on,.star-off{position:absolute;top:1rem;left:0;overflow:hidden}
.star-rate {margin-left:3.6rem}
.store-distance{float:right;color:#999}
.store-moneylimit{font-size:0.75rem}
.weui_cell_hd {
    padding: 0.6rem;
	padding-left: 0;
}
.fui-header a.back:before {
	content: " ";
	border-color: #fff;
}
</style>
<div class="fui-page order-create-page fui-page-current" ng-if="pagedata.op == 'main'">
<div class="fui-content">
		<div class="fui-picture">
				<a style="display: block; padding: {paddingtop}px {paddingleft}px;" data-nocache="true">
					<img ng-src="{{tomedia(pagedata.vipbg) || '../core/resource/images/nopic.jpg'}}">
				</a>
		</div>
		<div class="fui-cell-group fui-cell-click" style="padding-bottom:0.3rem;margin-top:0">
			<div class="fui-cell">
				<div class="fui-cell-label" style='width:auto' >付费方式</div>
				<div class="fui-cell-text"> <span ng-click="pagedata.type(1);" ng-class="{'jylabel jylabel-red':1,'active':pagedata.post.paytype==1}" style="margin-right:10px">按月支付</span><span ng-click="pagedata.type(2);" ng-class="{'jylabel jylabel-red':1,'active':pagedata.post.paytype==2}" style="margin-right:10px">按季支付</span><span ng-click="pagedata.type(3);" ng-class="{'jylabel jylabel-red':1,'active':pagedata.post.paytype==3}">按年支付</span></div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label" style='width:auto' >开通时长</div>
				<div class="fui-cell-mask noremark" style="margin-right:10px">
					 <div class="fui-number">
						<div class="minus" ng-click="pagedata.minus(pagedata.post.paytype)">-</div>
						<input class="num" type="tel" name="" value="{{pagedata.post.num}}" readonly="readonly"/>
						<div class="plus" ng-click="pagedata.plus(pagedata.post.paytype)">+</div>
					</div>
				</div>
				<div ng-if="pagedata.post.paytype==1" class="fui-cell-text">个月</div><div ng-if="pagedata.post.paytype==2"  class="fui-cell-text" >个季度</div><div ng-if="pagedata.post.paytype==3" class="fui-cell-text">年</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-label" style='width:auto' >费用合计：</div>
				<div class="fui-cell-text bold" style="color:red"> ￥{{pagedata.fee || '0.00'}} <span class="delete">原价:￥{{pagedata.fee0}}</span></div>
			</div>
			</div>
		<div class="weui_cells_checkbox" style="margin-top:2rem">
                <div class="fui-cell-label" style="text-align:center;margin:0 auto;padding:0.2rem">
                    <input type="checkbox" class="fui fui-checkbox fui-checkbox-danger verify-checkbox" style="line-height:0.6rem" ng-checked="pagedata.post.checked==true" ng-model="pagedata.post.checked">
					我已阅读并同意《<a onclick="$('#showsystemcontent').modal();" style="color:f60">会员协议</a>》
                </div>
        </div>
		<div class="weui_btn_area" style="margin-top:0">
			 <a class="weui_btn weui_btn_primary" href="javascript:" id="showTooltips" ng-click="pagedata.buyvip();">提交</a>
		</div>
</div>
</div>
<div id="showsystemcontent" class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
<div class="modal-dialog" style="width:96%;left:2%;top:1.5%;">
<div class="modal-content" style="min-height:500px">
	<div aria-hidden="true" data-dismiss="modal" class="closebtn" style="right:10px;top:0"><i class="icon jinyunicon icon-wrong" style="color:#ccc;"></i></div>
	<div class="fui-article-page">
			<div class="fui-article-title" style="text-align:center">平台声明</div>
			<div class="fui-article-content" ng-bind-html="trust(pagedata.basic.systemcontent)"></div>
	</div>
</div>
</div>
</div>
<div ng-include="sys_html('_footer')"></div>
<script type="text/javascript">
//购买
scope.pagedata.buyvip=function(){
	if(!scope.pagedata.post.checked){
		scope.message('请先阅读并勾选《会员协议》','error');
		return false;
	}
	scope.post_json('/buyvip/post/',scope.pagedata.post,function(res){
		console.log('payid');console.log(res.payid);
		scope.tool.pay(res.payid,function(res){
				console.log('收到支付结果！');
				if(res.type=='success'){
					scope.message('充值成功！','','goback');
				}else{
					scope.message('充值失败！'+res.message,'','goback');
				}
		},'','','/myhome/');
	});
	return
}
//减少
scope.pagedata.minus=function(type){
	if(scope.pagedata.post.num <=1){
		return false;
	}
	scope.pagedata.post.num--;
	scope.pagedata.jisuan(type,scope.pagedata.post.num);
	return
}
//增加
scope.pagedata.plus=function(type){
	scope.pagedata.post.num++;
	scope.pagedata.jisuan(type,scope.pagedata.post.num);
	return
}
//选择付款类型
scope.pagedata.type=function(type){
	scope.pagedata.post.num=1
	scope.pagedata.post.paytype = type;
	scope.pagedata.jisuan(type,scope.pagedata.post.num);
	return
}
//计算
scope.pagedata.jisuan=function(type,num){
	if(type ==1){
		scope.pagedata.fee = getprice(scope.pagedata.basic.mfee * num)
		if(scope.pagedata.basic.mfee0){
			scope.pagedata.fee0 = getprice(scope.pagedata.basic.mfee0 * num)
		}else{
			scope.pagedata.fee0 = getprice(scope.pagedata.basic.mfee * 1.5 * num)
		}
	}else if(type ==2){
		scope.pagedata.fee = getprice(scope.pagedata.basic.jfee * num)
		if(scope.pagedata.basic.jfee0){
			scope.pagedata.fee0 = getprice(scope.pagedata.basic.jfee0 * num)
		}else{
			scope.pagedata.fee0 = getprice(scope.pagedata.basic.jfee * 1.5 * num)
		}
		
	}else if(type ==3){
		scope.pagedata.fee = getprice(scope.pagedata.basic.yfee * num)
		if(scope.pagedata.basic.yfee0){
			scope.pagedata.fee0 = getprice(scope.pagedata.basic.yfee0 * num)
		}else{
			scope.pagedata.fee0 = getprice(scope.pagedata.basic.yfee * 1.5 * num)
		}
	}
	scope.$evalAsync();
}
function getprice(num)
{
	//var num = parseFloat(num);
	num = num.toFixed(2);
	//console.log(num);
	return num
	
}
</script>